{% extends "base.html" %}
{% load staticfiles %}
{% load crispy_forms_tags %}

{% block title %}
Search by tags
{% endblock %}

{% block extrahead %}
  <link rel="stylesheet" type="text/css" href="{% static "js-custom-themes/jquery-ui/theme/jquery-ui.css" %}" />
  <link href="{% static "js-custom-themes/tagit/theme/jquery.tagit.css" %}" rel="stylesheet" type="text/css"/>
{% endblock %}

{% block breadcrumb %}{% endblock %}

{% block content %}
<div class="row">
  <div class="large-12 columns">
    <div class="row">
      <div class="large-2 columns">&nbsp;</div>
      <div class="large-5 columns">
        <h2>Original</h2>
      </div>
      <div class="large-5 columns">
        <h2>Proposed</h2>
      </div>
    </div>
    {% for rev in revised %}
        <div class="row">
          <div class="large-2 columns">
            <p>Title:</p>
          </div>
          <div class="large-5 columns">
            <p><a href="{{ rev.link.get_absolute_url }}">{{ rev.link.title }}</a></p>
          </div>
          <div class="large-5 columns">
            <p><a href="{{ rev.link.get_absolute_url }}">{{ rev.title }}</a></p>
          </div>
        </div>
        <div class="row">
          <div class="large-2 columns">
            <p>Url:</p>
          </div>
          <div class="large-5 columns">
            <p><a href="{{ rev.link.url }}">{{ rev.link.url }}</a></p>
          </div>
          <div class="large-5 columns">
            <p><a href="{{ rev.url }}">{{ rev.url }}</a></p>
          </div>
        </div>
      {% if rev.level != '' %}
        <div class="row">
          <div class="large-2 columns">
            <p>Level:</p>
          </div>
          <div class="large-5 columns">
            <p>{{ rev.link.level }}</p>
          </div>
          <div class="large-5 columns">
            <p>{{ rev.level }}</p>
          </div>
        </div>
      {% endif %}
      {% if rev.language != None %}
        <div class="row">
          <div class="large-2 columns">
            <p>Language:</p>
          </div>
          <div class="large-5 columns">
            <p>{{ rev.link.language }}</p>
          </div>
          <div class="large-5 columns">
            <p>{{ rev.language }}</p>
          </div>
        </div>
      {% endif %}
      {% if rev.tags != '' %}
        <div class="row">
          <div class="large-2 columns">
            <p>Tags:</p>
          </div>
          <div class="large-5 columns">
            <p>{{ rev.link.tags }}</p>
          </div>
          <div class="large-5 columns">
            <p>{{ rev.tags }}</p>
          </div>
        </div>
      {% endif %}
      <div class="row">
        <iframe class="large-12 columns" src="/a/link/link/{{ rev.link.pk }}/" style="height: 520px"></iframe>
        <a href="/a/link/revisedlink/{{ rev.pk }}/delete/">DELETE REVISION PROPOSITION</a>
      </div>
      <hr />
    {% endfor %}
  </div>
</div>

<div class="row">
  <div class="large-12 columns">
    <h1>For these links, content generation for indexing failed</h1>
  </div>
  {% for link in links %}
  <div class="large-12 columns">
    <a href="{{ link.url }}">{{ link.title }}</a>
    <a href="/a/link/link/{{ link.pk }}/">EDIT LINK</a>
  </div>
  <hr />
  {% endfor %}
</div>

{% endblock %}

{% block last_body %}
<script type="text/javascript" src="{% static "bower_components/jquery-ui/ui/minified/jquery-ui.min.js" %}" ></script>
<script type="text/javascript" src="{% static "bower_components/tag-it/js/tag-it.min.js" %}" ></script>
<script type="text/javascript">
  $('#tags').tagit({
    availableTags: [{{ tags|safe }}],
    autocomplete: {delay: 0, minLength: 2},
    allowSpaces: true,
    afterTagAdded: search,
    afterTagRemoved: search
  });

  $('#tags2').tagit({
    availableTags: [{{ tags|safe }}],
    autocomplete: {delay: 0, minLength: 2},
    allowSpaces: true,
    afterTagAdded: search,
    afterTagRemoved: search
  });

});
</script>
{% endblock last_body %}
